package main

var peo = make(chan People, 10)
var sng = make(chan struct{})

type People struct {
	Son    int
	Father int
}

func producer() {
	for i := 0; i < 10; i++ {
		println("第", i, "次")
		peo <- People{
			Son:    i,
			Father: i,
		}
	}
	close(peo)
}

func consumer() {
	for z := range peo {
		println(z.Son + z.Father)
	}
	close(sng)
}

func main() {
	go producer()
	go consumer()
	<-sng
}
